#include <bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using i128 = __int128;
const int N = 1e6 + 5;

void solve() {
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    s = '0' + s;
    vector<bool> bo(n + 1, 0);
    int ans = 0;
    for (int i = 1; i <= n; i++) {
        bool f1 = 0;
        for (int j = max(i - k + 1, 0); j < i; j++) {
            if (s[j] == '1') f1 = 1;
        }
        if (f1 == 0 && s[i] == '1' && !bo[i]) {
            ans++;
            bo[i] = 1;
        }
    }
    cout << ans << endl;
    return;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int t;
    cin >> t;
    while (t--) solve();

    return 0;
}